package fr.afcepf.atod18.fw.form;

public class ConnexionForm implements IActionForm {
        
    private String login;
    private String password;
    private String message;
   
    @Override
    public boolean validateForm() {
        
       String msg = "";
        
        
        //TODO:  template à compléter/transformer
        if (this.getLogin().matches("login") && this.getPassword().matches("pass")) {
            this.setMessage("Passwd OK! Bienvenu " + this.getLogin());
            return true;
        }
        
        if (this.getLogin().matches("login") && !this.getPassword().matches("pass")) {
            msg = "Mauvais mot de passe";
        }
        
        if (!this.getLogin().matches("login") && this.getPassword().matches("pass")) {
            msg = "Mauvais login";
        }
                    
        this.setMessage(msg + " Non authentifié... " + this.getLogin());  
        return false;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @param paramMessage the message to set
     */
    public void setMessage(String paramMessage) {
        message = paramMessage;
    }

    /**
     * @return the login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @param paramLogin the login to set
     */
    public void setLogin(String paramLogin) {
        login = paramLogin;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param paramPassword the password to set
     */
    public void setPassword(String paramPassword) {
        password = paramPassword;
    }
}
